package com.zsrt.java.day20161228.lh.day.demo01;


import java.util.Arrays;

import org.junit.Test;

public class SelectionSort {
	
	@Test
	public void testName() throws Exception {
		
		int[] arr=new int[]{45,23,57,34,12};
		System.out.println(Arrays.toString(arr));
		
		int temp=0; 
		int len=arr.length;
		
		//选择排序
		for(int i=0;i<len-1;i++){
			for(int j=i+1;j<len;j++){
				
				if(arr[i]>arr[j]){
					temp=arr[j];
					arr[j]=arr[i];
					arr[i]=temp;
				}
			}
		}
		for (int  value : arr) {
			System.out.print(value+", ");
		}
	}
	
	

}
